package functional
{
	import event.functional.FuncEvent;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	public class ADdragAble extends ADbaseAble
	{
		public static const DRAG:String="drag";
		/**
		 *拖动区域 
		 */		
		public var rec:Rectangle
		public function ADdragAble()
		{
			super();
			event=MouseEvent.MOUSE_MOVE;
//			this.stateFunc=statef;
		}
		private function statef(skins:*, index:int):void
		{
			var beDrag:Sprite=(skins[index] as Sprite) ;
//			beDrag.startDrag(false,rec);
			targetCom.dispatchEvent(new FuncEvent(DRAG,new Point(skins[index].x/rec.width,skins[index].y/rec.height)))
 		}
		override public function set stateFunc(func:Function):void
		{
			super.stateFunc=function (skins:*,index:int):void{
				statef(skins,index);
				func(skins,index);
			}
		}
	}
}